<?php


/**
 * 异步redis操作
 */
class AsyncReids
{
	private $host = '127.0.0.1';
	private $port = '6379';

	private $redis_client = null;

	public function __construct()
	{
		$this->redis_client = new swoole_redis;
		$this->redis_client->connect($this->host,$this->port, function ($client, $result) {

		    if ($result === false) {
		        echo "connect to redis server failed.\n";
		        return;
		    }


		    $client->set('key', 'swoole', function ($client, $result) {
		        var_dump($result);
		        exit;
		    });

		});
	}
}


new AsyncReids();